/**
 * 为字符串添加分隔符（从前到后添加）
 */
export default function add_spliter(str: string, step: number, spliter: string) {
	const str_arr = [] as string[];
	for (let i = 0; i < str.length; i++) {
		str_arr.push(str[i]);
		if (step === 1 && i < str.length - 1) {
			str_arr.push(spliter);
		} else if (step > 1 && i < str.length - 1 && (i + 1) % step === 0) {
			str_arr.push(spliter);
		}
	}
	return str_arr.join('');
}
